#include "CryptoRecipient.h"
#include <string.h>
#include <algorithm>

namespace kryptos { namespace cryptography {

CryptoRecipient::CryptoRecipient(const std::string &id, const char *sessionkey, int len)
    : m_id(id)
{
    m_sessionKey.resize(len);
    m_sessionKey.assign(sessionkey, sessionkey+len);
}

std::string CryptoRecipient::id() const
{
    return m_id;
}

std::vector<char> CryptoRecipient::sessionKey() const
{
    return m_sessionKey;
}

std::vector<char> CryptoRecipient::bytes() const
{
    std::vector<char> aux;
    aux.resize(m_sessionKey.size() + m_id.length());

    std::copy(m_id.c_str(), m_id.c_str()+ m_id.size(), aux.begin());
    std::copy(m_sessionKey.begin(), m_sessionKey.end(), aux.begin() + m_id.length());

    return aux;
}

}}
